<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 绝对值方法    Math.abs()

        console.log(Math.abs(1));// 1
        console.log(Math.abs(-1));// 1
        console.log(Math.abs('1'));// 1 隐士装换
        console.log(Math.abs('hug'));// NaN

    //   取整数方法
    // 向下取整 Math.floor()
    console.log(Math.floor(1.2));// 1
    console.log(Math.floor(1.9));// 1
    // 向上取整 Math.ceil()
    console.log(Math.ceil(1.2));// 2
    console.log(Math.ceil(1.9));// 2
    // 四舍五入 Math.round
    console.log(Math.round(1.2));// 1
    console.log(Math.round(1.5));// 2



//Math.random随机数0-1不包括1
    // var my=function(min,max){
    //           return Math.floor(Math.random())*(max-min+1)+min;
    //     }
    //     console.log(my(2,4));

    </script>
</body>
</html>